package utils.loka.validation
{
	
	/**
	 * ...
	 *
	 * @history create Jul 8, 2012 6:25:16 PM
	 * @author g.savenko
	 */    
	public class ValidateMail
	{
		//------------------------------------------------
		//      Class constants
		//------------------------------------------------
		
		//------------------------------------------------
		//      Variables
		//------------------------------------------------
		
		//---------------------------------------------------------------
		//
		//      CONSTRUCTOR
		//
		//---------------------------------------------------------------
		public function ValidateMail()
		{
		}
		
		//---------------------------------------------------------------
		//
		//      PRIVATE & PROTECTED METHODS
		//
		//---------------------------------------------------------------
		
		
		//---------------------------------------------------------------
		//
		//      EVENT HANDLERS
		//
		//---------------------------------------------------------------
		
		
		//---------------------------------------------------------------
		//
		//      PUBLIC METHODS
		//
		//---------------------------------------------------------------
		
		public static function validate(value:String):Boolean
		{
			var result:Boolean = false;
			var regExpPattern : RegExp =/^[0-9a-zA-Z][-._a-zA-Z0-9]*@([0-9a-zA-Z][-._0-9a-zA-Z]*\.)+[a-zA-Z]{2,4}$/;
			
			if( value.match(regExpPattern) == null )
			{
				result = false;
			}
			else
			{
				result = true;
			}
			
			return result;
		}
		
		//---------------------------------------------------------------
		//
		//      ACCESSORS
		//
		//---------------------------------------------------------------
	}
}